<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<script type="text/javascript" src="./js/jquery-1.10.2.js"></script>
<script type="text/javascript">
	
	function checkIt(){
		if($('#checkValue').val()=="b"){
			return true;
		}else{
			alert("아이디 중복확인을 해주세요.");
			return false;
		}
	}

	$(document).ready(function() {

		$("#btnCheckId").click(function() {
			var id = $('#m_id').val();
			if(id==""){
				alert("아이디를 입력해주세요..");
				return;
			}
			$.getJSON("idCheck.do", {
				t_id : id
			}, function(data) {
				if(data.success==true){
					$('#msg').html("사용가능한 아이디 입니다.");
					$('#checkValue').val("b");
				}else{
					$('#msg').html("이미 사용중인 아이디 입니다.");
					$('#checkValue').val("a");
				}
			});
		});
	});
</script>
<form:form commandName="memberCommand" action="memberJoin.do" onsubmit="return checkIt()">
<form:errors element="div" />

	<table width="100%" height="100" border="0" align="center">
	<tr>  
	<td height="30"></td>
	</tr>
	
	<tr align="center"> 
	<input type="hidden" id="checkValue" value="a"/>	
	<td>아이디 : <form:input path="m_id" id="m_id"  size="10"/>
	<input id="btnCheckId" type="button" value="ID중복체크" />
	<span id="msg"></span>
	<form:errors path="m_id" />
	<br />
	</td></tr>
	
	
	<tr align="center">
	<td>비밀번호 : <form:password path="m_passwd" />
	<form:errors path="m_passwd" />
	<br />
	</td></tr>
	
	<tr align="center">
	<td>비밀번호 확인 : <input type="password" name="passwd2" />
	<br />
	</td></tr>
	   
	<tr align="center">
	<td>이름 : <form:input path="m_name" size="15" />
	<form:errors path="m_name" />
	<br />
	</td></tr>
	
	<tr align="center">
	<td>주소 : <form:input path="m_address" size="40" />
	<form:errors path="m_address" />
	<br/>
	</td></tr>
	
	<tr align="Center">
	<td>이메일 : <form:input path="m_email"  size="30" />
	<form:errors path="m_email" />
	<br />
	</td></tr>
	
	
	<tr align="center">
	<td>전화번호 : <form:input path="m_phone" />
	<form:errors path="m_phone" />
	<br />
	</td></tr>
	 
	</table>
	<table width="70%" height="50" border="0">
	<tr align="right">
	<td><input type="submit" value="가입"/>
	<input type="button" value="취소"
		onclick="location.href='/seoul-javas/index.jsp'" /></td>
		</tr>
	</table>

</form:form>
